<<<<<<< HEAD
package com.wwx.web;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;
import com.wwx.entity.CartoonDO;
import com.wwx.service.CartoonService;
import com.wwx.service.impl.CartoonServiceImpl;
/**
 * key值查询
 * @author WuC
 *
 */
public class SelectAction extends ActionSupport{
	private CartoonService s=new CartoonServiceImpl();
	private String keywordvalue;
	private String keyword;
	public String getKeywordvalue() {
		return keywordvalue;
	}
	public void setKeywordvalue(String keywordvalue) {
		this.keywordvalue = keywordvalue;
	}
	public String getKeyword() {
		return keyword;
	}
	public void setKeyword(String keyword) {
		this.keyword = keyword;
	}
	@Override
	public String execute() throws Exception {
//		System.out.println(keyword+"==="+keywordvalue);
		List<CartoonDO> list=s.getSelectByKey(keyword, keywordvalue);
		System.out.println("--list--"+list.size());
		for (CartoonDO cart : list) {
			System.out.println(cart+":漫画！");
		}
		HttpServletRequest request=ServletActionContext.getRequest();
		request.getSession().setAttribute("comlist", list);
		return SUCCESS;
	}
	
	public void selectAll() throws Exception {
		List<CartoonDO> list=s.selectAllCartoon();
		for (CartoonDO c : list) {
			System.out.println(c);
		}
		JSONArray array=JSONArray.fromObject(list);
		String str=array.toString();
		HttpServletResponse response=ServletActionContext.getResponse();
		response.getWriter().write(str);
		response.getWriter().flush();
		response.getWriter().close();
	}
	
}
=======
package com.wwx.web;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;
import com.wwx.entity.CartoonDO;
import com.wwx.service.CartoonService;
import com.wwx.service.impl.CartoonServiceImpl;
/**
 * key值查询
 * @author WuC
 *
 */
public class SelectAction extends ActionSupport{
	private CartoonService s=new CartoonServiceImpl();
	private String keywordvalue;
	private String keyword;
	public String getKeywordvalue() {
		return keywordvalue;
	}
	public void setKeywordvalue(String keywordvalue) {
		this.keywordvalue = keywordvalue;
	}
	public String getKeyword() {
		return keyword;
	}
	public void setKeyword(String keyword) {
		this.keyword = keyword;
	}
	@Override
	public String execute() throws Exception {
//		System.out.println(keyword+"==="+keywordvalue);
		List<CartoonDO> list=s.getSelectByKey(keyword, keywordvalue);
		System.out.println("--list--"+list.size());
		for (CartoonDO cart : list) {
			System.out.println(cart+":漫画！");
		}
		HttpServletRequest request=ServletActionContext.getRequest();
		request.getSession().setAttribute("comlist", list);
		return SUCCESS;
	}
	
	public void selectAll() throws Exception {
		List<CartoonDO> list=s.selectAllCartoon();
		for (CartoonDO c : list) {
			System.out.println(c);
		}
		JSONArray array=JSONArray.fromObject(list);
		String str=array.toString();
		HttpServletResponse response=ServletActionContext.getResponse();
		response.getWriter().write(str);
		response.getWriter().flush();
		response.getWriter().close();
	}
	
}
>>>>>>> dev
